<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="/admin/static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="/admin/lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/css/style.css" />
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>管理员{:empty($info)?'添加':'编辑'} - 管理员管理</title>
</head>
<body>
<nav class="breadcrumb">
	<i class="Hui-iconfont">&#xe67f;</i> 首页 
	<span class="c-gray en">&gt;</span> 管理员管理 
	<span class="c-gray en">&gt;</span> 管理员{:empty($info)?'添加':'编辑'}
	<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" >
		<i class="Hui-iconfont">&#xe68f;</i>
	</a>
</nav>
<article class="page-container">
	<form class="form form-horizontal" id="form-admin-add" action="{:url('admin_add')}" method="post">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">角色：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<span class="select-box" style="width:150px;">
					<select class="select" name="type" size="1" {:empty($info)?'':'disabled'}>
						<option value="0" {:$info.type===0?'selected':''}>超级管理员</option>
						<option value="1" {:$info.type==1?'selected':''}>培训机构</option>
						<option value="2" {:$info.type==2?'selected':''}>考官</option>
						<option value="3" {:$info.type==3?'selected':''}>核验人</option>
					</select>
				</span>
			</div>
		</div>
		{if condition="empty($info)"}
		<div class="row cl addType" style="display: none">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>添加方式：</label>
			<div style="padding-left: 15px;display: inline-block;">
				<input type="radio" name="addType" value="1" checked>自定义添加
				<input type="radio" name="addType" value="2">用户申请
			</div>
		</div>
		<div class="row cl school" {if condition="$info.type neq 1"}style="display: none"{/if}>
			<label class="form-label col-xs-4 col-sm-3">培训机构：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<span class="select-box" style="width:150px;">
					<select class="select" name="sname" size="1">
						{volist name="school" id="s"}
						<option value="{$s.id}" data-tel="{$s.tel}">{$s.name}</option>
						{/volist}
					</select>
				</span>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>联系电话：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$info.tel}" placeholder="联系电话" name="tel">
			</div>
		</div>
		{/if}
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>用户名：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$info.name}" placeholder="用于登录账号" id="adminName" name="name">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>初始密码：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" autocomplete="off" value="" placeholder="密码" id="password" name="password">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>确认密码：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" autocomplete="off"  placeholder="确认新密码" id="password2" name="password2">
			</div>
		</div>
		<div class="row cl addType" {if condition="$info.type neq 1"}style="display: none"{/if}>
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>机构地址：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$info.address}" placeholder="机构地址" name="address">
			</div>
		</div>
		<div class="row cl kaoguan" style="display: none">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>真实姓名：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$info.real_name}" placeholder="考官真实姓名" id="adminName" name="real_name">
			</div>
		</div>
		<!--<div class="row cl kaoguan" style="display: none">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>手机号码：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$info.tel}" placeholder="考官手机号码" id="adminName" name="tel">
			</div>
		</div>-->
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
				<input type="hidden" name="id" value="{$info.id}">
				<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
			</div>
		</div>
	</form>
</article>
<!--_footer 作为公共模版分离出去-->
{include file="public/js"}
<!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/admin/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="/admin/lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="/admin/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript">
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	//表单验证
	$("#form-article-add").validate({
		rules: {
			name:"required"
		}
	});
	$("select[name=type]").change(function(){
		$("input[name=tel]").val("");
		var type=$(this).find("option:selected").val();
		if (type==1) {
			$(".addType").show();
			$("input[name=addType]").change();
		}else{
			$(".addType").hide();
			$(".school").hide();
		}
		if (type==2) {
			$(".kaoguan").show();
		}else{
			$(".kaoguan").hide();
		}		
	})
	$("input[name=addType]").change(function(type=1){
		if ($(this).is(":checked")) {
			var i=$(this).val();//alert(i);
			if (i==2) {
				$(".school").show();
				$("input[name=tel]").css('readonly',true);
				$("input[name=tel]").val($("select[name=sname]").find("option:selected").attr("data-tel"));
			}else{
				$(".school").hide();
				$("input[name=tel]").val("");
			}
		}
	})
	$("select[name=sname]").change(function(){
		$("input[name=tel]").val($(this).find("option:selected").attr("data-tel"));
		
	})
	$(function(){
		$("select[name=type]").change();
	})
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>